<template>
  <div class="app-container">
    <!-- 上部分表单 -->
    <el-form
      :model="queryParams"
      ref="queryForm"
      :inline="true"
      label-width="85px"
      class="globalSerchFormStyle"
    >
      <el-row>
        <el-col :span="6" v-if="authUser">
          <el-form-item label="油企名称" prop="enterpriseId" size="small">
            <el-select
              style="width: 180px"
              v-model="queryParams.enterpriseId"
              :clearable="true"
              filterable
              placeholder="请选择油企"
              @change="handleSelectChange"
            >
              <el-option
                v-for="(item, index) in enterpriseList"
                :key="index"
                :value="item.enterpriseId"
                :label="item.enterpriseName"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="油站名称" prop="stationId" size="small">
            <el-select
              style="width: 180px"
              v-model="queryParams.stationId"
              :clearable="true"
              filterable
              placeholder="请选择油站名称"
            >
              <el-option
                v-for="item in stationList"
                :key="item.stationId"
                :label="item.stationName"
                :value="item.stationId"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="订单号" prop="orderNo">
            <el-input
              style="width: 180px"
              v-model="queryParams.orderNo"
              placeholder="请输入订单号"
              clearable
              @keyup.enter.native="handleQuery"
              size="small"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="支付方式" prop="payType" size="small">
            <el-select
              style="width: 180px"
              v-model="queryParams.payType"
              placeholder="请选择支付方式"
              clearable
            >
              <el-option :value="undefined" selected>全部</el-option>
              <el-option value="wx" label="微信支付"></el-option>
              <el-option value="pos" label="pos机支付"></el-option>
              <el-option value="yhk" label="银行卡支付"></el-option>
              <el-option value="zfb" label="支付宝支付"></el-option>
              <el-option value="dzk" label="电子卡支付"></el-option>
              <el-option value="xj" label="现金支付"></el-option>
              <el-option value="cdk" label="车队卡支付"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <div v-show="collapse">
        <el-row>
          <el-col :span="6">
            <el-form-item label="客户手机号" prop="likeCustomerPhone">
              <el-input
                style="width: 180px"
                v-model="queryParams.likeCustomerPhone"
                placeholder="请输入客户手机号"
                clearable
                @keyup.enter.native="handleQuery"
                size="small"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="油号名称" prop="oilName" size="small">
              <el-select
                style="width: 180px"
                v-model="queryParams.oilName"
                placeholder="请选择油号"
                clearable
              >
                <el-option :value="undefined" selected>全部</el-option>
                <el-option
                  :value="ele.oilId"
                  v-for="ele in oilList"
                  :key="ele.oilId"
                  :label="ele.oilName + '-' + ele.oilClass + '-' + ele.oilType"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="油枪名称" prop="oilGun" size="small">
              <el-select
                style="width: 180px"
                v-model="queryParams.oilGun"
                :clearable="true"
                filterable
                placeholder="请选择油枪"
              >
                <el-option
                  v-for="(item, index) in oilGunList"
                  :key="index"
                  :value="item"
                  :label="item"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="订单状态" prop="status" size="small">
              <el-select
                style="width: 180px"
                v-model="queryParams.status"
                placeholder="请选择订单状态"
                clearable
                size="small"
              >
                <el-option :value="undefined" selected>全部</el-option>
                <el-option value="0" label="未支付"></el-option>
                <el-option value="1" label="已支付"></el-option>
                <el-option value="2" label="线下退款"></el-option>
                <el-option value="3" label="线上退款"></el-option>
                <el-option value="4" label="支付失败"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="加油员" prop="oilPersonnelId" size="small">
              <el-select
                style="width: 180px"
                v-model="queryParams.oilPersonnelId"
                :clearable="true"
                filterable
                placeholder="请选择加油员"
              >
                <el-option
                  v-for="item in personnelList"
                  :key="item.userId"
                  :label="item.userName"
                  :value="item.userId"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="创建时间" prop="createdDate" size="small">
              <el-date-picker
                size="small"
                v-model="dateRangeCreatedDate"
                value-format="yyyy-MM-dd HH:mm:ss"
                type="datetimerange"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                style="width: 180px"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="商户号" prop="mno">
              <el-input
                style="width: 180px"
                v-model="queryParams.mno"
                placeholder="请输入商户号"
                clearable
                size="small"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="商户号备注" prop="remark">
              <el-input
                style="width: 180px"
                v-model="queryParams.remark"
                placeholder="请输入商户号备注"
                clearable
                size="small"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </div>
    </el-form>

    <el-row
      class="global_el_rowStyle"
      :gutter="10"
      style="
        border-top: none;
        border-bottom: 1px solid #f5f5f5;
        margin-top: 0px;
      "
    >
      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-search"
          @click="handleQuery"
          size="mini"
          >搜索</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          @click="resetQuery"
          size="mini"
          icon="el-icon-refresh"
          plain
          >重置</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          plain
          size="mini"
          id="closeSearchBtn"
          @click="
            (closeSearch) => {
              collapse = !collapse;
            }
          "
        >
          {{ collapse ? "收起" : "展开更多" }}
          <i :class="collapse ? 'el-icon-arrow-up ' : 'el-icon-arrow-down'"></i>
        </el-button>
      </el-col>
      <!-- <el-col :span="1.5" v-if="!authUser">
        <el-button
          icon="el-icon-tickets"
          size="mini"
          plain
          @click="gotoEditOrderDiscount"
        >
          优惠调整
        </el-button>
      </el-col> -->
      <el-col :span="1.5">
        <el-button
          plain
          :disabled="delIds.length < 1"
          icon="el-icon-delete"
          size="mini"
          @click="handleDelete"
          v-if="$store.state.user.userLevel === '1'"
          >撤销</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          :disabled="disabledButton"
          size="mini"
          @click="handleDeleteTotal"
          v-if="$store.state.user.userLevel === '1' && collapse"
          type="danger"
          >全部撤销</el-button
        >
      </el-col>
      <!-- <el-col :span="1.5">
        <el-button
          icon="el-icon-message"
          size="mini"
          @click="handleExport"
          plain
          >导出</el-button
        >
      </el-col> -->
    </el-row>
    <div style="width: 90%; margin: 20px 0px">
      <el-row :gutter="20">
        <el-col :span="5">
          <div class="order-fz order-text-border">
            应收总计：<span class="order-text-color"
              >{{ orderSum.receivableAmt }}元</span
            >
          </div>
        </el-col>
        <el-col :span="5">
          <div class="order-fz order-text-border">
            实收总计：<span class="order-text-color"
              >{{ orderSum.ssAmt }}元</span
            >
          </div>
        </el-col>
        <el-col :span="5">
          <div class="order-fz order-text-border">
            数量总计(L/kg)：<span class="order-text-color"
              >{{ orderSum.orderLiters }} (L/kg)</span
            >
          </div>
        </el-col>
        <el-col :span="5">
          <div class="order-fz">
            订单数：<span class="order-text-color"
              >{{ orderSum.countNum }}笔</span
            >
          </div>
        </el-col>
        <!-- <el-col :span="4">
          <div class="order-fz order-text-border">
            加油用户数：<span class="order-text-color">0人</span>
          </div>
        </el-col>
        <el-col :span="4">
          <div class="order-fz">
            余额支付金额：<span class="order-text-color">0元</span>
          </div>
        </el-col> -->
      </el-row>
    </div>
    <!-- <el-form :model="orderSum" ref="orderSum" :inline="true" label-width="128px">
      <el-form-item label="实收总计" prop="amt">
        <div style="font-size: 1.5vw"> {{ orderSum.ssAmt }}元</div>
      </el-form-item>
      <el-form-item label="应收总计" prop="receivableAmt">
        <div style="font-size: 1.5vw"> {{ orderSum.receivableAmt }}元</div>
      </el-form-item>
      <el-form-item label="升数总计" prop="orderLiters">
        <div style="font-size: 1.5vw"> {{ orderSum.orderLiters }}升</div>
      </el-form-item>
      <el-form-item label="订单数" prop="countNum">
        <div style="font-size: 1.5vw"> {{ orderSum.countNum }}</div>
      </el-form-item>
    </el-form> -->

    <!-- 表格 -->
    <el-table
      stripe
      style="width: 100%"
      :data="orderList"
      @selection-change="handleSelectionChange"
      v-loading="loading"
    >
      <el-table-column type="selection" width="55" />
      <af-table-column
        label="应付金额(元)"
        align="left"
        prop="receivableAmt"
        sortable
      />
      <af-table-column
        label="充值立减优惠金额(元)"
        align="center"
        prop="rechargeDiscountAmt"
        width="180"
        sortable
        v-if="this.$store.state.user.userLevel === null"
      />
      <af-table-column
        label="消费立减优惠金额(元)"
        align="center"
        prop="consumeDiscountAmt"
        v-if="this.$store.state.user.userLevel === null"
        width="180"
        sortable
      />
      <af-table-column label="实付金额(元)" align="left" prop="amt" sortable />
      <af-table-column
        label="立减优惠金额(元)"
        align="left"
        prop="discountAmt"
        width="170"
        sortable
      />
      <af-table-column
        label="优惠券金额(元)"
        align="left"
        prop="discountCouponAmt"
        width="160"
        sortable
      />
      <af-table-column
        v-if="authUser"
        label="提现(元)"
        align="center"
        prop="withdrawalAmount"
        width="100"
        sortable
      />
      <af-table-column
        label="支付时间"
        align="center"
        prop="payDate"
        width="170"
        sortable
      >
        <template slot-scope="scope">
          <span>{{
            parseTime(scope.row.payDate, "{y}-{m}-{d} {h}:{i}:{s}")
          }}</span>
        </template>
      </af-table-column>
      <af-table-column
        label="创建时间"
        align="left"
        prop="createdDate"
        width="170"
        sortable
      >
        <template slot-scope="scope">
          <span>{{
            parseTime(scope.row.createdDate, "{y}-{m}-{d} {h}:{i}:{s}")
          }}</span>
        </template>
      </af-table-column>
      <af-table-column
        label="订单状态"
        align="center"
        prop="status"
        :formatter="statusFotmat"
        width="130"
        sortable
      />
      <af-table-column
        label="客户手机号"
        align="center"
        width="170"
        prop="customerPhone"
        sortable
      >
      </af-table-column>

      <af-table-column
        label="客户姓名"
        align="center"
        width="180"
        prop="consumer"
        sortable
      />

      <af-table-column
        v-if="authUser"
        label="油企名称"
        align="center"
        width="200"
        show-overflow-tooltip
        prop="enterpriseName"
      />
      <af-table-column
        label="油站名称"
        align="center"
        width="200"
        show-overflow-tooltip
        prop="stationName"
        v-if="jiBie == 0 || jiBie == 1"
        sortable
      />
      <af-table-column
        label="油号名称"
        align="center"
        prop="oilName"
        width="120"
        sortable
      />
      <af-table-column
        label="油品价格(元)"
        align="center"
        prop="oilPirce"
        sortable
      />
      <af-table-column
        label="数量(L/kg)"
        align="center"
        prop="orderLiters"
        sortable
      />
      <af-table-column
        label="加油员"
        align="center"
        width="200"
        prop="oilPersonnel"
        sortable
      />
      <af-table-column
        label="油枪名称"
        align="center"
        width="180"
        prop="oilGun"
        sortable
      />
      <af-table-column
        label="支付方式"
        align="center"
        width="160"
        prop="payType"
        :formatter="payTypeFotmat"
        sortable
      />
      <af-table-column
        label="订单号"
        align="center"
        prop="orderNo"
        width="170"
        sortable
      />

      <af-table-column
        label="小票状态"
        align="center"
        width="160"
        prop="isPrint"
        sortable
      >
        <template slot-scope="scope">
          <span v-if="scope.row.isPrint === 0">未打印</span>
          <span v-else-if="scope.row.isPrint === 1">已打印</span>
        </template>
      </af-table-column>

      <af-table-column
        label="开票状态"
        width="130"
        align="center"
        prop="invoiceStatus"
        :formatter="invoiceStatusFotmat"
        sortable
      />
      <af-table-column
        label="订单来源"
        width="180"
        align="center"
        prop="utmSource"
        sortable
      >
        <template slot-scope="scope">
          <span v-if="scope.row.utmSource === '1'">扫码订单</span>
          <span v-if="scope.row.utmSource === '2'">平台订单</span>
          <span v-if="scope.row.utmSource === '3'">无感订单</span>
          <span v-if="scope.row.utmSource === '9'">其他订单</span>
        </template>
      </af-table-column>
      <af-table-column
        v-if="authUser"
        label="通道费承担方"
        align="left"
        prop="channelFeePayer"
        width="150"
        sortable
      >
        <template slot-scope="scope">
          <span v-if="scope.row.channelFeePayer == 0">司机</span>
          <span v-if="scope.row.channelFeePayer == 1">油企</span>
        </template>
      </af-table-column>
      <af-table-column
        v-if="authUser"
        label="费率"
        align="left"
        prop="serviceCharge"
        sortable
      >
        <template slot-scope="scope">
          <span>{{ scope.row.serviceCharge }}‰</span>
        </template>
      </af-table-column>
      <af-table-column
        label="商户号"
        width="130"
        align="center"
        prop="mno"
        sortable
      />
      <af-table-column
        label="商户号备注"
        width="200"
        align="center"
        prop="remark"
        sortable
      />
      <!-- <af-table-column
        label="操作"
        align="left"
        class-name="small-padding fixed-width"
        width="160px"
        v-if="reprint"
        fixed="right"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-plus"
            @click="printOrderInfo(scope.row)"
            >补打小票</el-button
          >
          <el-button size="mini" type="text" @click="printOrderInfo(scope.row)"
            >开票记录</el-button
          >
        </template>
      </af-table-column> -->
    </el-table>
    <!-- 分页 -->
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <el-dialog
      title="警告"
      :visible.sync="dialogVisible"
      width="30%"
      style="margin-top: 200px"
    >
      <span>是否撤销本次筛选页面上的所有订单？撤销后无法恢复</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogCancel" size="small">取 消</el-button>
        <el-button
          type="primary"
          @click="handleDeleteAll"
          size="small"
          :disabled="disabledCountdownTime"
          >确 定{{ countdownTime }}
        </el-button>
      </span>
    </el-dialog>

    <!-- 修改订单抽屉 -->
    <Order_DiscountAmount_Drawer
      :editDiscountDialog.sync="editDiscountDialog"
      @reloadData="getList"
    ></Order_DiscountAmount_Drawer>
  </div>
</template>
<script>
import { getGunList } from "@/api/station/order";
import {
  listOrder,
  exportOrder,
  printOrderInfo,
  selectSumPayOrder,
  delOrderDeletePay,
  deleteAllPayg,
  enterpriseList,
} from "@/api/station/orderHistory";
import { listPrice, getPrice } from "@/api/station/price";
import { listManage, feieList } from "@/api/station/manage";
import { getStationList, listEnterpriseStation } from "@/api/dept";
import { getOilListByLogin } from "@/api/dept";
import { listPersonnel, listEnterpriseUser } from "@/api/station/personnel";
import Order_DiscountAmount_Drawer from "./Order_DiscountAmount_Drawer.vue";

export default {
  name: "OrderCancel",
  components: { Order_DiscountAmount_Drawer },
  data() {
    return {
      // 倒计时
      countdownTime: null,
      // 倒计时禁用
      disabledCountdownTime: false,
      // 定时器
      intervalid: null,
      // 全部撤销
      dialogVisible: false,
      collapse: false,
      //创建订单时间间隔
      dateRangeCreatedDate: [],
      // 总条数
      total: 0,
      // 订单支付表格数据
      orderList: [],
      oilNameOptions: [],
      // 字典
      payTypeOptions: [],
      // 下拉油站
      stationOptions: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        levelId: this.levelId,
        pageNum: 1,
        pageSize: 10,
        status: null,
        oilGun: null,
        oilName: null,
        stationId: null,
        orderType: null,
        //orderType:1,
        oilPersonnel: null,
        createdDate: null,
        likeConsumer: null,
        orderNo: null,
        customerPhone: null,
        stationId: null,
        enterpriseId: null,
        oilPersonnelId: null,
        // 商户号
        mno: null,
        // 备注商户号
        remark: null,
      },
      orderSum: {
        amt: null,
        receivableAmt: null,
        orderLiters: null,
        countNum: null,
      },
      // 表单校验
      rules: {},
      reprint: false,
      oilList: [],
      operation: 1,
      stationList: [],
      personnelList: [],
      delIds: [],
      oilGunList: [],
      enterpriseList: [],
      loading: false,
      editDiscountDialog: false, // 优惠调整抽屉
    };
  },
  created() {
    this.getList();
    this.getOilList();
    this.getPersonnelList();
    this.getOilListData()
    this.getEnterpriseList(); // 获取油企数据
    // 如果是油企账号，就根据油企业账号获取油站
    if (this.presentEnterprise && this.presentEnterprise.enterpriseId) {
      this.getStationList(this.presentEnterprise.enterpriseId);
    }
    feieList({
      pageNum: 1,
      pageSize: 1,
    }).then((response) => {
      const equipmentList = response.rows;
      if (!!equipmentList) {
        if ((equipmentList[0] || {}).deviceType == "3") {
          this.reprint = true;
        }
      }
    });
    //字典
    // this.getDicts("pay_type").then((response) => {
    //   this.payTypeOptions = response.data;
    // });
    // this.getDicts("oil_name").then((response) => {
    //   this.oilNameOptions = response.data;
    // });
  },
  computed: {
    disabledButton() {
      const length = this.orderList.length;
      if (length) {
        return false;
      } else {
        return true;
      }
    },
    authUser() {
      let roles = this.$store.state.user.roles;
      if (roles.includes("admin")) {
        return true;
      } else {
        return false;
      }
    },
  },
  methods: {
     // 查询油枪列表
     async getOilListData() {
      const res = await getGunList()
      this.oilGunList = res.data
    },
    // 根据油企获取该油企下的油站
    handleSelectChange(enterpriseId) {
      this.stationList = [];
      this.queryParams.stationId = null;
      this.getStationList(enterpriseId);
    },
    // 查询油企
    getEnterpriseList() {
      enterpriseList().then((res) => {
        this.enterpriseList = res.rows;
      });
    },
    // 勾选表格
    handleSelectionChange(selection) {
      this.delIds = selection.map((item) => {
        return item.orderId;
      });
    },

    //撤销
    handleDelete() {
      this.$confirm(`确认撤销勾选的订单吗？`).then(() => {
        delOrderDeletePay(this.delIds).then((res) => {
          if (res && res.code === 200) {
            this.$message.success(res.msg);
            this.delIds = [];
            this.getList();
          } else {
            this.$message.error(res.msg);
          }
        });
      });
    },

    // 全部撤销按钮
    handleDeleteTotal() {
      let time = 10;
      this.countdownTime = ` ( ${time} ) `;
      this.disabledCountdownTime = true;
      this.intervalid = setInterval(() => {
        time--;
        this.countdownTime = ` ( ${time} ) `;
        if (time <= 0) {
          this.disabledCountdownTime = false;
          this.countdownTime = "";
          clearInterval(this.intervalid);
        }
      }, 1000);
      this.dialogVisible = true;
    },

    // 取消全部撤销
    dialogCancel() {
      clearInterval(this.intervalid);
      this.dialogVisible = false;
    },

    //确认全部撤销
    handleDeleteAll() {
      this.queryParams.levelId = this.levelId;
      let queryParams = this.queryParams;
      let userLevel = this.$store.state.user.userLevel;
      if (["1", "2"].includes(userLevel)) {
        queryParams.isDeleted = 0;
      }

      deleteAllPayg(
        this.addDateRange(queryParams, this.dateRangeCreatedDate)
      ).then((res) => {
        if (res && res.code === 200) {
          this.$message.success(res.msg);
          this.getList();
          this.dialogVisible = false;
        } else {
          this.$message.error(res.msg);
        }
      });
    },

    getOilList() {
      getOilListByLogin()
        .then((res) => {
          if (res.code == 200) {
            this.oilList = res.rows;
          } else {
            throw new Error("");
          }
        })
        .catch(() => {
          this.msgError("拉取油品列表失败，请刷新网页~");
        });
    },
    getPersonnelList() {
      listEnterpriseUser().then((res) => {
        this.personnelList = res;
      });
    },
    payTypeFotmat(row, column) {
      const types = {
        wx: "微信支付",
        zfb: "支付宝",
        xj: "现金支付",
        dzk: "电子卡支付",
        pos: "POS机支付",
        yzf: "预支付",
        kbzf: "卡包支付",
        yhk: "银行卡支付",
        cdk: "车队卡支付",
      };
      if (types[row.payType]) {
        return types[row.payType];
      } else {
        return row.payTypeName;
      }
    },
    statusFotmat(row, column) {
      if (row.status === "0") {
        return "未支付";
      } else if (row.status === "1") {
        return "已支付";
      } else if (row.status === "2") {
        return "线下退款";
      } else if (row.status === "3") {
        return "线上退款";
      } else if (row.status === "4") {
        return "支付失败";
      }
    },

    // 格式化开票状态
    invoiceStatusFotmat(row, column) {
      const types = {
        0: "未开票",
        1: "已开票",
        2: "部分开票",
        3: "不支持开票",
      };
      return types[row.invoiceStatus];
    },

    getStationList(enterpriseId) {
      listEnterpriseStation({ enterpriseId: enterpriseId }).then((res) => {
        this.stationList = res;
      });
    },
    /** 查询订单支付列表 */
    getList() {
      this.loading = true;
      this.queryParams.levelId = this.levelId;
      let queryParams = this.queryParams;
      let userLevel = this.$store.state.user.userLevel;
      if (["1", "2"].includes(userLevel)) {
        queryParams.isDeleted = 0;
      }

      listOrder(this.addDateRange(queryParams, this.dateRangeCreatedDate))
        .then((response) => {
          this.orderList = response.rows;
          this.total = response.total;
          this.loading = false;
        })
        .catch(() => {
          this.orderList = [];
          this.total = 0;
          this.loading = false;
        });
      selectSumPayOrder(
        this.addDateRange(queryParams, this.dateRangeCreatedDate)
      )
        .then((response) => {
          this.orderSum = this.initData(response.data);
        })
        .catch(() => {
          this.loading = false;
        });
    },
    initData(data) {
      let queryData = data;
      Object.keys(queryData).forEach((key) => {
        if (["ssAmt", "receivableAmt", "orderLiters"].includes(key)) {
          if (
            queryData[key] === "" ||
            queryData[key] === undefined ||
            !queryData[key]
          ) {
            queryData[key] = 0;
          }
        }
      });
      return queryData;
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRangeCreatedDate = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },

    //打印订单小票
    // printOrderInfo(row) {
    //   printOrderInfo({ orderId: row.orderId }).then((response) => {
    //     this.msgSuccess("小票打印成功");
    //   });
    // },

    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm("是否确认导出所有订单支付数据项?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(function () {
          return exportOrder(queryParams);
        })
        .then((response) => {
          this.download(response.msg);
        });
    },

    // 修改订单
    gotoEditOrderDiscount() {
      this.editDiscountDialog = true;
    },
  },
};
</script>
<style lang="scss" scoped>
.app-container {
  margin-top: -15px;
}

.button-from {
  width: 100%;
  display: flex;
  flex-wrap: wrap;

  .button-style1 {
    display: inline-block;
    width: 80px;

    .el-button {
      margin: 0 0 0 15px;
    }
  }
}

::v-deep .card-table {
  padding: 10px;
  margin-top: 8px;
  background-color: #f8f8f8;

  .el-button {
    margin: 0 5px 0 0;
  }
}

::v-deep .el-table {
  border: 1px #f8f8f8 solid;
  border-bottom: 1px #dfe6ec solid;
}

::v-deep .is-center {
  border: 1px transparent solid;
  border-bottom: 1px #f8f8f8 solid;
}

.order-fz {
  font-size: 13px;
}

.order-text-border {
  border-right: 1px solid #999999;
}

.order-text-color {
  color: #1990ff;
}
</style>
